package com.gyh.system.sys.web;

import java.util.HashSet;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gyh.system.common.persistence.BaseController;
import com.gyh.system.common.tools.ModuleTree;
import com.gyh.system.common.utils.R;
import com.gyh.system.common.utils.TreeUtils;
import com.gyh.system.sys.entity.Menu;
import com.gyh.system.sys.service.MenuService;

/**
* @author 作�?? gyh
* @version 创建时间  $date
* �˵�
*/
@RestController
@RequestMapping("/menu")
@CrossOrigin
public class MenuController extends BaseController{
	
	
	@Autowired
	private MenuService menuService;
	
	@GetMapping
	@SuppressWarnings({"unchecked","rawtypes"})
	public R searchMenus() {
		List<Menu> menus = menuService.findAllList();
		List<ModuleTree> treeList = TreeUtils.toListTree(menus);
		return R.ok(treeList);
	}
	
}